package com.hutu.kboshi.dao;

import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hutu.kboshi.mapper.LikesMapper;
import com.hutu.kboshi.pojo.entity.Likes;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.List;

@Slf4j
@Repository
public class LikesDao extends ServiceImpl<LikesMapper, Likes> implements IService<Likes> {

    public Likes isLikes(Long userId, Long problemId) {
        return lambdaQuery().eq(Likes::getUserId, userId)
                .eq(Likes::getProblemId, problemId)
                .one();
    }

    public List<Long> getProductIdsByUserId(Long userId) {
        return baseMapper.getProductIdsByUserId(userId);
    }
}